// 封装高阶组件
import { Navigate } from "react-router-dom";

export const AuthRoute = ({ children }) => {
  const token = localStorage.getItem("token");
  if (token) {
    return <>{children}</>;
  } else {
    return <Navigate to={"/login"} replace></Navigate>;
  }
};
